import request from "@/utils/request";
const BASE_URL = "wblog_article";

export default {
  searchPage(page, size, searchMap) {
    return request({
      url: `${BASE_URL}/category/search/${page}/${size}`,
      method: "post",
      data: searchMap
    });
  },
  addCategory(pojo) {
    return request({
      url: `${BASE_URL}/category`,
      method: "post",
      data: pojo
    });
  },
  updateCategory(pojo) {
    return request({
      url: `${BASE_URL}/category/${pojo.id}`,
      method: "put",
      data: pojo
    });
  },
  getCategoryById(id) {
    return request({
      url: `${BASE_URL}/category/${id}`,
      method: "get"
    });
  },
  deleteById(id,isparent) {
    return request({
      url: `${BASE_URL}/category/${id}/${isparent}`,
      method: "put"
    });
  },
  /**
   * 获取树形数据
   */
  fetchCategoryTree(){
    return request({
      url:`${BASE_URL}/category/tree`,
      method:"post"
    })
  }
};
